<?
require("config.php");

$location_status .= " | Delete";

$show_backnav = "category_menu";

$menuname = NULL;

$menutarget = NULL;

if (NULL!=$action){

   $Query = "delete from $table where id = $id Limit 1";
   myQuery($Query);

   //unlink($PIC_DIR . "$table/" . $Logo);

   header("location:" . $rela_path . "share/msg.php?v=12");

   exit;

}

if (!checkRecord($table,$id)){

	header("location:" . $rela_path . "share/msg.php?v=9002");
  
  }

	$Query = "select id, code, name, logo, parent, product,sort,level,cname,publish,limits from $table where id = $id";
	$r = myQuery($Query);

	if (!$r)header("location:" . $rela_path . "share/msg.php?v=9002");
	$Code = $r[0][1];
	$Name = $r[0][2];
	$Logo = $r[0][3];
	$Parent = $r[0][4];
	$product_str=$r[0][5];
	$Sort=$r[0][6];
	$level=$r[0][7];
	$CName=$r[0][8];
	$publish=$r[0][9];
	$limit=$r[0][10];
	

	$P_str='';
	
	while ($level>0 && $Parent!='0') {
		$Query = "select id, code, name, logo, parent,product,sort,level from $table where id = $Parent";
		$r = myQuery($Query);
		$Parent = $r[0][4];
		$pname	= $r[0][2];
		if ($P_str) $P_str= $pname.' > '.$P_str;
			else $P_str= $pname;
		$level= $r[0][7];
	}

$Query="select id,code,name from pro_basic where publish='1' order by id desc;";
$r=myQuery($Query);
$product='';
for ($i=0 ; $i<count($r) ; $i++) {
	if (substr_count($product_str,'|'.$r[$i][0].'|')) $product.=$r[$i][1].'-'.$r[$i][2].'<br />';
}

require($rela_path . "inc/header.php");

?> 

<form action="" method="post" name="form1">
<table width="95%" border="0" align="center">
  <tr> 
    <td align="right">&nbsp; </td>
  </tr>
  <tr> 
    <td><p>Are you sure to delete this category ? 
          <input type="Submit" class="button" name="Submit" value="  Yes  ">
          <input type="button" class="button" name="Submit32" value="  No  " onClick="Redirect('category_menu.php',1);">
          <br>
          <br>
        </p>
        <table>
          <tr>
            <td class="tdheader">Code :</td>
            <td><?print($Code)?><br> 
              <!--hidden field-->
              <input name="action" type="hidden" value="delete"> <input name="id" type="hidden" value="<?print($id)?>"> 
              <input name="Logo" type="hidden" value="<?print($Logo)?>"> </td>
          </tr>

          <tr>
            <td class="tdheader">Parent :</td>
            <td><?print($P_str)?></td>
          </tr>

          <tr>
            <td class="tdheader">Name :</td>
            <td><?print($Name)?></td>
          </tr>
        <tr>
          <td class="tdheader">Chinese Name :</td>
          <td><?print($CName)?></td>
        </tr>
          <tr>
            <td class="tdheader">Sort :</td>
            <td><?print($Sort)?></td>
          </tr>
        <tr>
          <td class="tdheader">Publish :</td>
          <td><? echo ($publish)?"Yes":"No"; ?></td>
        </tr>
        <tr>
          <td class="tdheader">Sales Limit :</td>
          <td><?print($limit)?></td>
        </tr>
		  <!--
        <tr> 
          <td valign="top" class="tdheader">Logo :</td>
          <td> 
            <?loadImage($Logo,$rela_path . $PIC_DIR . "$table/")?>
          </td>
        </tr>
		  <tr>
            <td class="tdheader">Related Items :</td>
			<td><?=$product?></td>
		  </tr>-->
        </table>
        <p><br>
        </p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp;</p>
      <p>&nbsp; </p></td>
  </tr>
</table>
</form>
<?
require($rela_path . "inc/footer.php");
?>
